#include "PowerFlowCalculation.h"


double PLoss_Calculation(Node m_Node[],int Node_Num,gsl_matrix* m_G,gsl_matrix *m_B)
{
    double Ploss = 0.0;
    for(int i=0;i<Node_Num;i++)
    {
        for(int j=0;j<Node_Num;j++)
        {
            double f = m_Node[i].Angle - m_Node[j].Angle;
            Ploss = Ploss + m_Node[i].Vol * m_Node[j].Vol * (gsl_matrix_get(m_G,i,j)*cos(f) + gsl_matrix_get(m_B,i,j)*sin(f));
        }
    }
    return Ploss;
}